import { getLevelZeroJson } from '@/utils';
import { DesignModelAPI } from '../common/type';
import { filterTree, handleDutySearchList } from '../common/common';

/** 流程设计搜索 */
const getSearchColumns = (): DesignModelAPI.IHeaderSearchType => {
  let orgDeptList: any[] = getLevelZeroJson();
  /** 处理组织机构数据 */
  const dutyIdList = handleDutySearchList(filterTree(orgDeptList), 'text', 'id');
  return [
    {
      name: 'ownCompanyID',
      placeholder: '所属单位',
      label: '所属单位',
      componentType: 'TreeSelect',
      dataSource: dutyIdList,
      allowClear: true,
      md: 5,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'name',
      label: '流程名称',
      placeholder: '流程名称',
      componentType: 'Input',
      allowClear: true,
      md: 5,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'isRelease',
      placeholder: '是否发布',
      label: '是否发布',
      componentType: 'Select',
      dataSource: [
        {
          name: '已发布',
          value: '1',
        },
        {
          name: '未发布',
          value: '0',
        },
      ],
      allowClear: true,
      md: 5,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'createTime',
      placeholder: '创建',
      label: '创建时间',
      componentType: 'RangePicker',
      allowClear: true,
      md: 9,
      sm: 24,
      whetherSenior: false,
    },
  ];
};

export { getSearchColumns };
